<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport"/>
    <link rel="stylesheet" href="css/amazeui.min.css">
    <link rel="stylesheet" href="css/animate.min.css">
    <link rel="stylesheet" href="css/style.css">
    <title>我的社区</title>
</head>
<body>
<header data-am-widget="header" class="am-header am-header-default" style="background-color: #FF856E;">

    <div class="am-header-left am-header-nav">
        <a href="javascript:history.go(-1);">
            <i class="am-icon-chevron-left" style="font-size: 20px;"></i>
        </a>
        <span style="font-size: 18px;color: white;">我的社区</span>
    </div>

</header>

<ul style="padding-left: 0;" class="am-list confirm-list" id="userCommunityList">
</ul>

<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">我的社区</div>
        <div class="am-modal-bd">
            你，确定要删除这条记录吗？
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>确定</span>
        </div>
    </div>
</div>


<div style="height: 60px;"></div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/amazeui.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>

<script type="text/javascript">
    $(function () {
        getUserCommunity();

        $('#userCommunityList').find('.am-btn-link').on('click', function () {
            $('#my-confirm').modal({
                relatedTarget: this,
                onConfirm: function (options) {
                    const $link = $(this.relatedTarget).prev('div');
                    const communityId = $link.data('id');
                    const msg = deleteCommunity(communityId);
                    if (msg == "success"){
                        alert(msg)
                        $("#" + communityId).remove();
                    }
                }
            });
        });
    })

</script>
</html>